<template>
  <div>
    <!--<headerPage title="领用申请" small="Requisition for consumables"></headerPage>-->
    <el-row>
      <el-col>
        <el-form :inline="true" :model="formInline" class="demo-form-inline">
          <el-form-item class="search">
            <el-input v-model="formInline.user" placeholder="请输入名称"></el-input>
          </el-form-item>
          <el-form-item class="search">
            <el-input v-model="formInline.user" placeholder="请输入负责人"></el-input>
          </el-form-item>
          <el-form-item class="search">
            <el-select clearable v-model="formInline.region" placeholder="请选择状态">
              <el-option label="启用" value="shanghai"></el-option>
              <el-option label="禁用" value="beijing"></el-option>
            </el-select>
          </el-form-item>
          <el-form-item class="search">
            <el-button type="primary" size="small">查询</el-button>
          </el-form-item>
        </el-form>
      </el-col>
    </el-row>
    <el-row>
      <el-col>
        <el-table
          :data="tableData"
          border
          style="width: 100%">
          <el-table-column
            align="center"
            prop="user"
            label="名称">
          </el-table-column>
          <el-table-column
            align="center"
            prop="user"
            label="购置时间">
          </el-table-column>
          <el-table-column
            align="center"
            prop="user"
            label="规格">
          </el-table-column>
          <el-table-column
            align="center"
            prop="user"
            label="库存">
          </el-table-column>
          <el-table-column
            align="center"
            prop="user"
            label="供应商">
          </el-table-column>
          <el-table-column
            align="center"
            prop="status"
            label="管理员">
          </el-table-column>
          <el-table-column
            align="center"
            prop="createUser"
            label="创建人">
          </el-table-column>
          <el-table-column
            align="center"
            prop="date"
            label="创建时间">
          </el-table-column>
          <el-table-column
            align="center"
            width="120px"
            label="操作">
            <template slot-scope="scope">
              <el-button type="primary" size="small" @click="dialogFormVisible2 = true">领用</el-button>
            </template>
          </el-table-column>
        </el-table>
        <el-pagination
          class="pagination"
          background
          layout="prev, pager, next"
          :total="1000">
        </el-pagination>
      </el-col>
    </el-row>
    <el-dialog title="领用耗材" :visible.sync="dialogFormVisible2">
      <el-row>
        <el-col>
          <el-form :model="form2" :label-width="formLabelWidth">
            <el-row>
              <el-col :span="12">
                <el-form-item label="耗材名称">
                  <el-input v-model="form2.name" autocomplete="off"></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="规格">
                  <el-input v-model="form2.name" autocomplete="off"></el-input>
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="12">
                <el-form-item label="库存">
                  <el-input v-model="form2.name" autocomplete="off"></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="管理员">
                  <el-input v-model="form2.name" autocomplete="off"></el-input>
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="12">
                <el-form-item label="领用数量">
                  <el-input v-model="form2.name" autocomplete="off"></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="用途">
                  <el-input type="textarea" v-model="form2.name" autocomplete="off"></el-input>
                </el-form-item>
              </el-col>
            </el-row>
            <el-form-item label="备注">
              <el-input type="textarea" v-model="form2.name" autocomplete="off"></el-input>
            </el-form-item>
            <el-form-item label="附件上传" :label-width="formLabelWidth">
            <el-upload
              action="https://jsonplaceholder.typicode.com/posts/"
              list-type="picture-card">
              <i class="el-icon-plus"></i>
            </el-upload>
            <el-dialog :visible.sync="dialogVisible">
              <img width="100%" :src="dialogImageUrl" alt="">
            </el-dialog>
            </el-form-item>
          </el-form>
        </el-col>
      </el-row>
      <div slot="footer" class="dialog-footer">
        <el-button @click="dialogFormVisible2 = false">取 消</el-button>
        <el-button type="primary" @click="dialogFormVisible2 = false">确 定</el-button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
  export default {
    name: "consuming",
    data() {
      return{
        dialogImageUrl: '',
        dialogVisible: false,
        form: {},
        form2:{},
        formLabelWidth: '120px',
        dialogFormVisible: false,
        dialogFormVisible2: false,
        formInline: {},
        tableData: [{
          user: 'A01',
          email: '545082052@qq.com',
          createUser: 'superAdmin',
          date: '2018-08-08',
          status: '启用',
          status2: "正常"
        }, {
          user: 'A02',
          email: '545082052@qq.com',
          createUser: 'superAdmin',
          date: '2018-08-08',
          status: '禁用',
          status2: '归档'
        }, {
          user: 'B01',
          email: '545082052@qq.com',
          createUser: 'superAdmin',
          date: '2018-08-08',
          status: '禁用',
          status2: "正常"
        }, {
          user: 'B02',
          email: '545082052@qq.com',
          createUser: 'superAdmin',
          date: '2018-08-08',
          status: '启用',
          status2: '归档'
        }]
      }
    },
    methods: {
      handleNodeClick(data) {
        console.log(data);
      }
    }
  }
</script>

<style scoped lang="scss">
  .search{
    margin-bottom: 10px;
  }
  /deep/.el-select{
    width: 100%;
  }
  .addDev {
    /deep/.el-form-item__content {
      display: flex;
    }
  }
</style>
